package main.service;
import main.repository.*;


import java.util.*;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import main.entity.*;
import main.vo.*;

@Service
public class GengxinxyfUserService {

//系统生成代码,请不要修改或删除 <actionStart:gengxinmjxyf>
	public Integer gengxinmjxyf(String userID, Integer creditVar) throws Exception{
        //当前函数的代码为自动生成,请勿手动修改!!!
        java.util.List < Yonghufjxx > user = com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.YonghufjxxRepository.class).queryEntityByFyonghuidEquals(userID);
        Yonghufjxx CurrentUser = com.justep.util.ListUtil.getFirst(user);
        CurrentUser.setFxinyongf(CurrentUser.getFxinyongf() + creditVar);
        com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.YonghufjxxRepository.class).saveAndFlush(CurrentUser);
        return CurrentUser.getFxinyongf();

    }
//系统生成代码,请不要修改或删除 <actionEnd:gengxinmjxyf>

//系统生成代码,请不要修改或删除 <actionEnd:gengxinmjxyf>	


//系统生成代码,请不要修改或删除 <actionStart:gengxinspkc>
public String gengxinspkc(String spID, Integer num) throws Exception{
        //当前函数的代码为自动生成,请勿手动修改!!!
        Shangpin1 list = com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.Shangpin1Repository.class).findOne(spID);
        list.setFkucun(num);
        com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.Shangpin1Repository.class).saveAndFlush(list);
        return "已更新";

    }
//系统生成代码,请不要修改或删除 <actionEnd:gengxinspkc>
	



	



	



	


//系统生成代码,请不要修改或删除 <actionStart:genggaiddzt>
public String genggaiddzt(String sys_XCredentialUserId, String orderID, String state) throws Exception{
        //当前函数的代码为自动生成,请勿手动修改!!!
        java.util.List < Dingdan > orders = com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.DingdanRepository.class).queryEntityByFidEqualsAndFyonghuEquals(orderID, sys_XCredentialUserId);
        if (!(com.justep.util.ListUtil.isEmpty(orders))) {
            Dingdan currentOrder = com.justep.util.ListUtil.getFirst(orders);
            currentOrder.setFdingdanzt(state);
            com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.DingdanRepository.class).saveAndFlush(currentOrder);
            return "状态更新成功";
        } else {
            return "啥也没找到";
        }

    }
//系统生成代码,请不要修改或删除 <actionEnd:genggaiddzt>

	



	



	



	


//系统生成代码,请不要修改或删除 <actionStart:jujuedffw>
public String jujuedffw(String helperID, String sys_XCredentialUserId) throws Exception{
        //当前函数的代码为自动生成,请勿手动修改!!!
        java.util.List < Bangbangm > Helper = com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.BangbangmRepository.class).queryEntityByFidEqualsAndFfaqiridEquals(helperID, sys_XCredentialUserId);
        if ((com.justep.util.ListUtil.isEmpty(Helper))) {
            return "请求不存在";
        } else {
            Bangbangm helper = com.justep.util.ListUtil.getFirst(Helper);
            helper.setFfuwuzid("");
            com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.BangbangmRepository.class).saveAndFlush(helper);
            return "已拒绝";
        }

    }
//系统生成代码,请不要修改或删除 <actionEnd:jujuedffw>


	



	



	



	


//系统生成代码,请不要修改或删除 <actionStart:dingdandhzxfk>
public String dingdandhzxfk(String orderID, String sys_XCredentialUserId) throws Exception{
        //当前函数的代码为自动生成,请勿手动修改!!!
        java.util.List < Dingdan > orders = com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.DingdanRepository.class).queryEntityByFidEqualsAndFmaijiaidEquals(orderID, sys_XCredentialUserId);
        if (!(com.justep.util.ListUtil.isEmpty(orders))) {
            Dingdan currentOrder = com.justep.util.ListUtil.getFirst(orders);
            currentOrder.setFdingdanzt("待付款");
            com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.DingdanRepository.class).saveAndFlush(currentOrder);
            return "已打回";
        } else {
            return "订单不存在";
        }

    }
//系统生成代码,请不要修改或删除 <actionEnd:dingdandhzxfk>



	



	



	



	


//系统生成代码,请不要修改或删除 <actionStart:qingqiujh>
public String qingqiujh(String helperID, String sys_XCredentialUserId) throws Exception{
        //当前函数的代码为自动生成,请勿手动修改!!!
        Bangbangm helper = com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.BangbangmRepository.class).findOne(helperID);
        if ((sys_XCredentialUserId.equals(helper.getFfaqirid()))) {
            return "不能接自己的活哦";
        } else {
            java.util.List < Yonghufjxx > usersys = com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.YonghufjxxRepository.class).queryEntityByFyonghuidEquals(sys_XCredentialUserId);
            if ((com.justep.util.ListUtil.isEmpty(usersys))) {
                return "补充信息";
            } else {
                Yonghufjxx userInfo = com.justep.util.ListUtil.getFirst(usersys);
                if ((userInfo.getFxinyongf() <= -30)) {
                    return "信用过低";
                } else {
                    helper.setFfuwuzid(sys_XCredentialUserId);
                    com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.BangbangmRepository.class).saveAndFlush(helper);
                    return "接活成功";
                }
            }
        }

    }
//系统生成代码,请不要修改或删除 <actionEnd:qingqiujh>




	



	



	



	


//系统生成代码,请不要修改或删除 <actionStart:dingdanfh>
public String dingdanfh(String orderID, String sys_XCredentialUserId) throws Exception{
        //当前函数的代码为自动生成,请勿手动修改!!!
        java.util.List < Dingdan > Order = com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.DingdanRepository.class).queryEntityByFidEqualsAndFmaijiaidEquals(orderID, sys_XCredentialUserId);
        if ((com.justep.util.ListUtil.isNotEmpty(Order))) {
            Dingdan currentOrder = com.justep.util.ListUtil.getFirst(Order);
            currentOrder.setFdingdanzt("待收货");
            com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.DingdanRepository.class).saveAndFlush(currentOrder);
            return "操作完成";
        } else {
            return "订单不存在";
        }

    }
//系统生成代码,请不要修改或删除 <actionEnd:dingdanfh>





	



	



	



	


//系统生成代码,请不要修改或删除 <actionStart:gengxinzhycjrltlbdsj>
public void gengxinzhycjrltlbdsj(String sys_XCredentialUserId) throws Exception{
        //当前函数的代码为自动生成,请勿手动修改!!!
        java.util.List < Yonghufjxx > User = com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.YonghufjxxRepository.class).queryEntityByFyonghuidEquals(sys_XCredentialUserId);
        if (!((com.justep.util.ListUtil.isEmpty(User)) || (org.apache.commons.lang.StringUtils.isBlank(sys_XCredentialUserId)))) {
            Yonghufjxx currentUser = com.justep.util.ListUtil.getFirst(User);
            currentUser.setFzuihouycfwltlbdsj(com.justep.util.DateTimeUtil.now());
            com.justep.cloud.boot.service.X5ContextService.getInstance(main.repository.YonghufjxxRepository.class).saveAndFlush(currentUser);
        }

    }
//系统生成代码,请不要修改或删除 <actionEnd:gengxinzhycjrltlbdsj>






	



	



	



	

}